package com.photonpay.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 卡状态枚举
 *
 * @author ：lo-
 * @date ：Created in 2023/11/24 16:14
 */
@AllArgsConstructor
@Getter
public enum CardStatusEnum {
    NORMAL("normal", "可用"),
    PENDING_RECHARGE("pending_recharge", "待充值"),
    UNACTIVATED("unactivated", "未激活"),
    FROZEN("frozen", "冻结"),
    FREEZING("freezing", "冻结中"),
    RISK_FROZEN("risk_frozen", "风控冻结"),
    SYSTEM_FROZEN("system_frozen", "系统冻结"),
    UNFREEZING("unfreezing", "解冻中"),
    EXPIRED("expired", "过期"),
    CANCELING("canceling", "销卡中"),
    CANCELLED("cancelled", "销卡");

    private final String code;
    private final String description;

    public static CardStatusEnum getByCode(String code) {
        for (CardStatusEnum status : CardStatusEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的卡状态 code: " + code);
    }
}
